from typing import Sequence, Iterable

import matplotlib.pyplot as plt
import numpy as np

from pynumpak.type import Interval, func_t


def plot(func: Sequence[func_t], ab: Interval, points: int = 500):
    x0 = np.linspace(ab[0], ab[1], points + 1)
    if isinstance(func, Iterable):
        for fu in func:
            plt.plot(x0, fu(x0))
    else:
        plt.plot(x0, func(x0))
    plt.show()
